#include <iostream>
#include <optional>

using namespace std;

bool func(int num, int *result)
{
    *result = num * num;
    return true;
}

pair<bool, int> func2(int num)
{
    pair<bool, int> p1;
    if (num != 0)
    {
        p1.first = true;
        p1.second = num * num;
    }
    else
    {
        p1.first = false;
        p1.second = 0;
    }

    return p1;
}

optional<int> func3(int num)
{
    if (num != 0)
    {
        return num * num;
    }
    else
    {
        return nullopt;
    }
}

int main(int argc, char **argv)
{
    int num = 10;
    int result = 0;

    int temp = func(num, &result);

    auto p = func2(num);
    if (p.first == true)
    {

    }

    auto p2 = func3(0);
    if(p2.has_value())
    {
        cout << p2.value() << endl;
    }


    return 0;
}